//
//  ZPBOneCollectionViewCell.m
//  WZLProduct
//
//  Created by boys on 16/3/21.
//  Copyright © 2016年 HaiTeng. All rights reserved.
//

#import "ZPBOneCollectionViewCell.h"

@implementation ZPBOneCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.numberLabel = [[UILabel alloc] init];

        [self.contentView addSubview:_numberLabel];
        self.coverNameImage = [[UIImageView alloc] init];

        [self.contentView addSubview:_coverNameImage];
        self.qNameLabel = [[UILabel alloc] init];

        [self.contentView addSubview:_qNameLabel];
        self.sNameLabel = [[UILabel alloc] init];

        [self.contentView addSubview:_sNameLabel];
        self.heartImage = [[UIImageView alloc] init];

        [self.contentView addSubview:_heartImage];
        self.likeLabel = [[UILabel alloc] init];

        [self.contentView addSubview:_likeLabel];
        self.playImage = [[UIImageView alloc] init];

        [self.contentView addSubview:_playImage];
       
        
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    [_numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(15);
        make.centerY.mas_equalTo(self.contentView);
        make.height.offset(20);
        make.width.offset(20);
    }];
    [_coverNameImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.numberLabel.mas_right).with.offset(10);
        make.top.offset(5);
        make.bottom.offset(-5);
        make.width.offset(self.height);
    }];
    [_qNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(10);
        make.bottom.offset(-40);
        make.left.equalTo(self.coverNameImage.mas_right).with.offset(10);
        make.width.offset(110);
    }];
    [_sNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.qNameLabel.mas_bottom).with.offset(10);
        make.bottom.offset(-15);
        make.left.equalTo(_qNameLabel);
        make.width.offset(65);
    }];
    [_heartImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.qNameLabel.mas_bottom).with.offset(10);
        make.bottom.offset(-15);
        make.left.equalTo(self.sNameLabel.mas_right).with.offset(5);
        make.width.offset(20);
    }];
    [_likeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.qNameLabel.mas_bottom).with.offset(10);
        make.bottom.offset(-15);
        make.left.equalTo(self.heartImage.mas_right).with.offset( 10);
        make.width.offset(70);
    }];
    [_playImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView);
        make.right.offset(-10);
        make.width.height.offset(25);
    }];
}

- (void)setModel:(ZPBThirdGetModel *)model {
    _model = model;
    [_coverNameImage sd_setImageWithURL:[NSURL URLWithString:model.picUrl] placeholderImage:nil];
    _sNameLabel.text = model.singerName;
    _sNameLabel.alpha = 0.4;
    _sNameLabel.font = FONT14;
    
    _qNameLabel.text = model.name;
    _qNameLabel.font = FONT16;
    
    _likeLabel.text = [NSString stringWithFormat:@"%@", model.favorites];
    _likeLabel.font = FONT13;
    _likeLabel.alpha = 0.4;
    
    _heartImage.image = [UIImage imageNamed:@"iconfont-aixin.png"];
    _playImage.image = [UIImage imageNamed:@"iconfont-bofang.png"];
    
}

@end
